package cn.snmp.mutual.org.opennms.protocols.snmp;

import java.net.*;

public class SnmpPeer implements Cloneable {
    private InetAddress m_peer;
    private int m_port;
    private int m_retries;
    private int m_timeout;
    private SnmpParameters m_params;
    public static final int defaultRemotePort = 161;
    public static final int defaultRetries = 3;
    public static final int defaultTimeout = 8000;

    public SnmpPeer(final InetAddress peer) {
        this.m_peer = peer;
        this.m_port = 161;
        this.m_timeout = 8000;
        this.m_retries = 3;
        this.m_params = new SnmpParameters();
    }

    public SnmpPeer(final InetAddress peer, final int port) {
        this(peer);
        this.m_port = port;
    }

    public SnmpPeer(final SnmpPeer second) {
        this.m_peer = second.m_peer;
        this.m_port = second.m_port;
        this.m_timeout = second.m_timeout;
        this.m_retries = second.m_retries;
        this.m_params = (SnmpParameters) second.m_params.clone();
    }

    public InetAddress getPeer() {
        return this.m_peer;
    }

    public void setPeer(final InetAddress addr) {
        this.m_peer = addr;
    }

    public void setPeer(final InetAddress addr, final int port) {
        this.m_peer = addr;
        this.m_port = port;
    }

    public int getPort() {
        return this.m_port;
    }

    public void setPort(final int port) {
        this.m_port = port;
    }

    public int getRetries() {
        return this.m_retries;
    }

    public void setRetries(final int retry) {
        this.m_retries = retry;
    }

    public int getTimeout() {
        return this.m_timeout;
    }

    public void setTimeout(final int timeout) {
        this.m_timeout = timeout;
    }

    public SnmpParameters getParameters() {
        return this.m_params;
    }

    public void setParameters(final SnmpParameters params) {
        this.m_params = params;
    }

    public Object clone() {
        return new SnmpPeer(this);
    }
}
